﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DAL;
using Models;

namespace BLL
{
    /// <summary>
    /// 轮播
    /// </summary>
   public class RotationaBLL
    {
        //轮播添加
        public static bool lunboAddBLL(Rotationa r) {
            return RotationaDAL.lunboAdd(r)>0;
        }
        //数据刷新
        public static DataTable selectLunboBLL() {
            return RotationaDAL.selectLunbo();
        }
        //模糊查询
        public static DataTable mhCXBLL(string title) {
            return RotationaDAL.mhCX(title);
        }
        //查询数据条数
        public static object dataNumBLL(){
            return RotationaDAL.dataNum();
        }
        //图片查看
        public static object tupianBLL(int id) {
            return RotationaDAL.tupian(id);
        }
        //轮播删除
        public static int lbSC(int id)
        {
            return RotationaDAL.lbSC(id);
        }
        //轮播
        public static List<Rotationa> SelectTbLunBo()
        {
            SqlDataReader dr = RotationaDAL.SelectTbLunBo();
            List<Rotationa> tbLunBos = new List<Rotationa>();
            while (dr.Read())
            {
                Rotationa lunbo = new Rotationa();
                lunbo.RotationaID = dr.GetInt32(0);
                lunbo.Title = dr.GetString(1);
                lunbo.image = dr.GetString(2);
                tbLunBos.Add(lunbo);
            }
            dr.Close();
            return tbLunBos;
        }
    }
}
